package com.mycat.core.mapper;

import com.mycat.core.pojo.Book;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

public interface BookMapper {
    @Select("select * from book")
    public List<Book> queryAll();

    @Select("select * from book where bid=#{bid}")
    public Book queryById(@Param("bid") int bid);

    @Delete("delete from book where bid=#{bid}")
    public void deleteById(@Param("bid") int bid);

    @Update("update book set bname=#{book.bname},author=#{book.author},price=#{book.price} where bid=#{book.bid}")
    public void update(@Param("book") Book book);

    @Insert("insert into book(bid,bname,author,price)values(#{book.bid},#{book.bname},#{book.author},#{book.price})")
    public void insert(@Param("book") Book book);
}
